package com.jjt.kiki.service;

import java.util.List;

import com.jjt.kiki.bean.Ip;
import com.jjt.kiki.dao.IpDao;

public class IpService {
	IpDao ipDao = new IpDao();
	public void save(Ip ip) {
		if(!this.isExist(ip))
			ipDao.save(ip);
	}
	private boolean isExist(Ip ip) {
		int count = ipDao.countByIp(ip);
		if(count==0)
			return false;
		return true;
	}
	public void delete(Ip ip) {
		ipDao.delete(ip.getIpId());
	}
	public List<Ip> findTop(int size){
		return ipDao.findTop(size);
	}
}
